﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel.Description;
using System.ServiceModel;
using ServiceContract;

namespace ConsoleApplicationReferingMultipleContractInOneService
{
    class Program
    {
        static void Main(string[] args)
        {
            var fixedAddress = "http://localhost:58722/MathServiceHost.svc/mex";
            var availableBindings = MetadataResolver.Resolve(typeof(IMathService), new EndpointAddress(fixedAddress));
            var factoryService = new ChannelFactory<IMathService>(availableBindings[0]);
            IMathService accesService = factoryService.CreateChannel();

            Console.WriteLine(accesService.Sum(5, 23));
            Console.ReadLine();

        }
    }
}
